var dbinstance;
var dbhelper = {
    /**
      * 返回可写数据库连接实例
     *
     * @method instance
     * @return {Object} dbinstance
     */
    instance: function () {
        if (!dbinstance) {
            dbinstance = require('knex')(this.config.dbconnection.mysql);
        }

        return dbinstance;
    },

    config: {
        dbconnection: {
            mysql: {
                client: 'mysql',
                connection: {
                    host: '127.0.0.1',
                    user: 'root',
                    password: '123456',
                    database: 'test',
                    port:33061
                }
            }
        }
    }
};

module.exports = dbhelper;